package org.edu.modules.growth.config;

import com.google.common.collect.Lists;
import lombok.Getter;
import org.edu.modules.growth.vo.DictVo;

import java.util.List;


/**
 * @author 86133
 */

@Getter
public enum UateTimeTypeUseEnum {

    /**
     * 考核时间类型
     */
    TYPE1("期初","QC"),
    TYPE2("期末","QM");
    private final String typeName;

    private final String typeVal;

    UateTimeTypeUseEnum(String typeName, String typeVal) {
        this.typeName = typeName;
        this.typeVal = typeVal;
    }

    /**
     * 通过vale-获取name
     */
    public static String getNameByValue(String value) {
        if( value != null ){
            for (UateTimeTypeUseEnum v : UateTimeTypeUseEnum.values()) {
                if (value == v.getTypeVal()) {
                    return v.getTypeName();
                }
            }
        }
        return null ;
    }

    /**
     * 获取字典
     */
    public static List<DictVo> getDict() {
        List<DictVo> types = Lists.newArrayList() ;
        for (UateTimeTypeUseEnum v : UateTimeTypeUseEnum.values()) {
            types.add(new DictVo()
                    .setKey(v.getTypeVal())
                    .setValue(v.getTypeName()));
        }
        return types ;
    }



}
